class RussellWilliamsTests extends GroovyTestCase {

	//HW3 unit tests for Russell Williams


	// tests for authentication of adminstrative user; all tests but the last
	// will return false and NOT authenticate the user - the final test will
	// pass in valid username/password and the user will be authenticated
	// (to call all test cases run the command: grails test-app)


	//pass in valid username/invalid password; should return false
	void testInvalidPasswordLogin() {
		def ac = new AdminController()
		assert ac.authenticateUser("admin","invalid_password") == false
    }

	//pass in invalid username/valid password; should return false
    void testInvalidUserLogin() {
		def ac = new AdminController()
		assert ac.authenticateUser("invalid_user","smf") == false
    }

	//pass in valid username/null password; should return false
    void testNullPasswordLogin() {
		def ac = new AdminController()
		assert ac.authenticateUser("admin",null) == false
    }

	//pass in null username/valid password; should return false
    void testNullUserLogin() {
		def ac = new AdminController()
		assert ac.authenticateUser(null,"smf") == false
    }

	//pass in valid username/empty password; should return false
    void testEmptyPasswordLogin() {
		def ac = new AdminController()
		assert ac.authenticateUser("admin","") == false
	}

	//pass in null username/valid password; should return false
	void testEmptyUserLogin() {
		def ac = new AdminController()
		assert ac.authenticateUser("","smf") == false
    }

	//pass in valid username/password; should authenticate
	void testValidLogin() {
		def ac = new AdminController()
		assert ac.authenticateUser("admin","smf") == true
    }



}
